﻿var $ = jQuery.noConflict();
var JustMarvel = JustMarvel || {};

(function ($) {
    JustMarvel.initialize = {
        init: function () {
            JustMarvel.initialize.showDate();
            //用户登录
            JustMarvel.initialize.user();
            JustMarvel.platform.init();
        },
        exdata: function () {
            $.ajax({
                url: "examples/widget1.json",
                type: "GET",
                dataType: "jsonp",
                success: function (data) {},
                error: function () {}
            });
        },
        showDate: function () {
            var datacontent = $(".systemdate"),
                oldday,
                newday;
            Date.prototype.format = function (fmt) { //author: meizz   
                var o = {
                    "M+": this.getMonth() + 1, //月份   
                    "d+": this.getDate(), //日   
                    "h+": this.getHours(), //小时   
                    "m+": this.getMinutes(), //分   
                    "s+": this.getSeconds(), //秒   
                    "q+": Math.floor((this.getMonth() + 3) / 3), //季度   
                    "S": this.getMilliseconds() //毫秒   
                };
                if (/(y+)/.test(fmt))
                    fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
                for (var k in o)
                    if (new RegExp("(" + k + ")").test(fmt))
                        fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
                return fmt;
            };

            //oldday = new Date().toLocaleDateString();
            var showtime = self.setInterval(function () {
                datacontent.html(new Date().format("yyyy-MM-dd hh:mm:ss"));
                //newday = new Date().toLocaleDateString();
                ////console.log(oldday,newday);
                //if (newday > oldday) {
                //    window.location.reload();
                //    console.log(oldday,newday);
                //};
            }, 1000);
        },
        user: function () {
            //console.log($.cookie('login'), $.cookie('username'));


            if ($.cookie('login') == 'true' && $.cookie('username') != null) {
                $('.username').html($.cookie('username'));
            };

            $("#logout").on('click', function () {
                $.cookie('login', 'false');
                $.cookie('username', '');
                $.cookie('right', '');
                window.location.replace('login.html');
            });
        },
    };

    //后台框架
    JustMarvel.platform = {
        init: function () {
            JustMarvel.platform.frame();
            JustMarvel.platform.sideMenu();
            JustMarvel.platform.contentScorll();
            JustMarvel.platform.pageInit();
        },
        frame: function () {
            $wrapper.width($window.width()).height($window.height());
        },
        sideMenu: function () {
            $(".aside-menu").height($(".aside-menu").height());
            $(".aside-menu").mCustomScrollbar({
                scrollButtons: {
                    enable: false,
                },
                autoHideScrollbar: true,
                theme: "light-thin"
            });

            $(".has-sub-menu").on('click', function (e) {
                e.stopPropagation();
                $(this).toggleClass('open');
                $(this).find('.sub-menu').slideToggle(300, 'easeInCubic');
                setTimeout(function () {
                    $(".aside-menu").mCustomScrollbar("update")
                }, 500);
            });
            $(".menu-item").on('click', function (e) {
                $(this).toggleClass('active');
                e.stopPropagation();
            });
        },
        contentScorll: function () {
            $("#sub-content").height($("#sub-content").height());
            $("#sub-content").mCustomScrollbar({
                scrollButtons: {
                    enable: false,
                },
                autoHideScrollbar: true,
                theme: "dark-thin"
            });
            //当内部有冒泡click事件，update滚动条
            $("#sub-content").on('click', function () {
                setTimeout(function () {
                    $("#sub-content").mCustomScrollbar("update")
                }, 500);
            });


        },
        //页面初始化
        pageInit: function () {
            if ($pageIndex.length > 0) {
                JustMarvel.platform.pageIndex.init();
            };
            if ($pageAccount.length > 0) {
                JustMarvel.platform.pageAccount.init();
            };
            if ($pageAccountGroup.length > 0) {
                JustMarvel.platform.pageAG.init();
            };
            if ($pageAgent.length > 0) {
                JustMarvel.platform.pageAgent.init();
            };
            if ($pageAgentGroup.length > 0) {
                JustMarvel.platform.pageAgentGroup.init();
            };
            if ($pageAgentReport.length > 0) {
                JustMarvel.platform.pageAgentReport.init();
            };
            if ($pageDevice.length > 0) {
                JustMarvel.platform.pageDevice.init();
            };
            if ($pageDeviceGroup.length > 0) {
                JustMarvel.platform.pageDeviceGroup.init();
            };
            if ($page4G.length > 0) {
                JustMarvel.platform.page4g.init();
            };
            if ($pageVideoLibrary.length > 0) {
                JustMarvel.platform.pageVideoLibrary.init();
            };
            if ($pageCarData.length > 0) {
                JustMarvel.platform.pageCarData.init();
            };
            if ($pageCarEvent.length > 0) {
                JustMarvel.platform.pageCarEvent.init();
            };
            if ($pageCarManage.length > 0) {
                JustMarvel.platform.pageCarManage.init();
            };
            if ($pageTask.length > 0) {
                JustMarvel.platform.pageTask.init();
            };
            if ($pageReceipt.length > 0) {
                JustMarvel.platform.pageReceipt.init();
            };
            if ($pageSN.length > 0) {
                JustMarvel.platform.pageSN.init();
            };
            if ($pageWrokOrder.length > 0) {
                JustMarvel.platform.pageWrokOrder.init();
            };
            if ($pageSystem.length > 0) {
                JustMarvel.platform.pageSystem.init();
            };
            if ($pageAdmin.length > 0) {
                JustMarvel.platform.pageAdmin.init();
            };
        }
    };
    //首页
    JustMarvel.platform.pageIndex = {
        init: function () {
            console.log("主页");
            JustMarvel.platform.pageIndex.indexswiper();
            JustMarvel.platform.pageIndex.indexechart();
        },
        indexswiper: function () {
            var shortcut = new Swiper('.swiper-shortcut', {
                direction: 'horizontal',
                loop: true,
                pagination: {
                    el: '.shortcut-pagination',
                    clickable: true,
                    bulletClass: 'index-bulletElement',
                },
            });
            var todolist = new Swiper('.swiper-todolist', {
                direction: 'horizontal',
                loop: true,
                pagination: {
                    el: '.todolist-pagination',
                    clickable: true,
                    bulletClass: 'index-bulletElement',
                },
            });
            var dataoverview = new Swiper('.swiper-dataoverview', {
                direction: 'horizontal',
                loop: true,
                pagination: {
                    el: '.dataoverview-pagination',
                    clickable: true,
                    bulletClass: 'index-bulletElement',
                },
            });
            var productnews = new Swiper('.swiper-productnews', {
                direction: 'horizontal',
                loop: true,
                pagination: {
                    el: '.productnews-pagination',
                    clickable: true,
                    bulletClass: 'index-bulletElement',
                },
            });
        },
        indexechart: function () {
            var chartOne = echarts.init(document.getElementById('chartOne')),
                optionOne = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {
                            type: 'cross',
                            label: {
                                backgroundColor: '#6a7985',
                            }
                        },
                    },
                    legend: {
                        bottom: '10',
                        data: ['上海', '北京', '广州', '深圳', '武汉'],

                    },
                    gird: {
                        left: '0%',
                        right: '0%',
                        bottom: '3%',
                        containLabel: true,
                    },
                    xAxis: [{
                        type: 'category',
                        boundaryGap: false,
                        data: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
                    }],
                    yAxis: [{
                        type: 'value'
                    }],
                    series: [{
                            name: '上海',
                            type: 'line',
                            smooth: true,
                            areaStyle: {},
                            data: [120, 132, 101, 134, 90, 230, 210, 157, 87, 301, 354, 280],
                        },
                        {
                            name: '北京',
                            type: 'line',
                            smooth: true,
                            areaStyle: {},
                            data: [245, 282, 204, 283, 213, 219, 252, 108, 284, 225, 249, 228],
                        },
                        {
                            name: '广州',
                            type: 'line',
                            smooth: true,
                            areaStyle: {},
                            data: [233, 272, 222, 101, 172, 258, 195, 227, 134, 237, 161, 247],
                        },
                        {
                            name: '深圳',
                            type: 'line',
                            smooth: true,
                            areaStyle: {},
                            data: [259, 117, 272, 122, 153, 120, 112, 300, 103, 157, 216, 192],
                        },
                        {
                            name: '武汉',
                            type: 'line',
                            smooth: true,
                            areaStyle: {},
                            data: [258, 138, 167, 178, 122, 208, 133, 293, 228, 297, 279, 164],
                        },
                    ]
                };
            var chartTwo = echarts.init(document.getElementById('chartTwo')),
                optionTwo = {
                    tooltip: {
                        trigger: 'item',
                        formatter: "{a} <br/>{b} : {c} ({d}%)"
                    },
                    legend: {
                        orient: 'horizontal',
                        bottom: '20',
                        data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
                    },
                    series: [{
                        name: '访问来源',
                        type: 'pie',
                        radius: '70%',
                        center: ['50%', '50%'],
                        data: [{
                                value: 335,
                                name: '直接访问'
                            },
                            {
                                value: 310,
                                name: '邮件营销'
                            },
                            {
                                value: 234,
                                name: '联盟广告'
                            },
                            {
                                value: 135,
                                name: '视频广告'
                            },
                            {
                                value: 1548,
                                name: '搜索引擎'
                            }
                        ],
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }]
                };
            var chartThree = echarts.init(document.getElementById('chartThree')),
                optionThree = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: { // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    legend: {
                        data: ['活跃用户', '总注册用户', '离线用户']
                    },
                    grid: {
                        left: '0%',
                        right: '0%',
                        containLabel: true
                    },
                    xAxis: [{
                        type: 'value'
                    }],
                    yAxis: [{
                        type: 'category',
                        axisTick: {
                            show: false
                        },
                        data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
                    }],
                    series: [{
                            name: '活跃用户',
                            type: 'bar',
                            label: {
                                normal: {
                                    show: true,
                                    position: 'inside'
                                }
                            },
                            data: [200, 170, 240, 244, 200, 220, 210]
                        },
                        {
                            name: '总注册用户',
                            type: 'bar',
                            stack: '总量',
                            label: {
                                normal: {
                                    show: true
                                }
                            },
                            data: [320, 302, 341, 374, 390, 450, 420]
                        },
                        {
                            name: '离线用户',
                            type: 'bar',
                            stack: '总量',
                            label: {
                                normal: {
                                    show: true,
                                    position: 'left'
                                }
                            },
                            data: [-120, -132, -101, -134, -190, -230, -210]
                        }
                    ]
                };
            chartOne.setOption(optionOne);
            chartTwo.setOption(optionTwo);
            chartThree.setOption(optionThree);
        },


    };
    //账户管理
    JustMarvel.platform.pageAccount = {
        init: function () {
            console.log("账户管理");
            JustMarvel.platform.pageAccount.menu();
            JustMarvel.platform.pageAccount.dataInit();
            JustMarvel.platform.pageAccount.viewRecord();
            JustMarvel.platform.pageAccount.editRecord();
            JustMarvel.platform.pageAccount.delRecord();
            JustMarvel.platform.pageAccount.addRecord();
            JustMarvel.platform.pageAccount.batchDel();
            JustMarvel.platform.pageAccount.search();
            JustMarvel.platform.pageAccount.goto();
        },
        menu: function () {

        },
        //数据初始化
        dataInit: function () {
            //$(".record-tool li a").on('click', function () {
            //    $("#edit-content").fadeToggle(300, 'easeInCubic');
            //});

        },
        //查看
        viewRecord: function () {
            $('.viewRecord').on('click', function () {

                $('#viewRecord').find('input,select').attr("disabled", true); //disabled要在数据获取后添加，先写数据获取的方法，数据填充后VIEW操作，给所有INPUT，SELECT添加disabled
                $('#viewRecord').modal('show'); //显示模态框
                $(this).parents('tr').addClass('info'); //高亮选中行
            });

            $('#viewRecord').on('hidden.bs.modal', function (e) {
                //这里要执行清除数据
                $('#viewRecord').find('input,select').attr("disabled", false); //要清除表单数据
                //添加的按钮需要清除
                $('#record-submit').remove();
                $('#record-add').remove();

                $('.data-table tr').removeClass('info'); //清除行高亮
            })
        },
        //编辑
        editRecord: function () {
            $('.editRecord').on('click', function () {

                $(this).parents('tr').addClass('warning');

                //这里先通过接口获取数据，获取数据后，添加编辑按钮
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-submit\"><i class=\"fa fa-save\"></i>保存</a>");

                $('#viewRecord').modal('show');

                //添加的提交按钮，绑定提交事件
                $('#record-submit').on('click', function () {

                });
                //模态框隐藏后事件
                $('#viewRecord').on('hidden.bs.modal', function () {
                    $('.data-table tr').removeClass('warning'); //清除行高亮
                });

            });

        },
        //删除
        delRecord: function () {
            $('.delRecord').on('click', function () {
                $(this).parents('tr').addClass('danger');
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //确认删除
                $('#confirm-del').on('click', function () {
                    alert('删除');
                    $('#warning-message').alert('close');
                });
            });
        },
        //增加
        addRecord: function () {
            $('#addRecord').on('click', function () {
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-add\"><i class=\"fa fa-plus\"></i>添加</a>");
                $('#viewRecord').modal('show');
            });

        },
        //批量删除
        batchDel: function () {
            //全选
            $("#selectAll").on("click", function () {
                if ($(this).prop("checked")) {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", true);
                } else {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", false);
                }
            });


            //操作删除
            $('#batchDel').on('click', function () {
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //alert('批量删除');

            });
        },
        //搜索
        search: function () {

            $('#startDate').datetimepicker({
                language: 'zh-CN',
                format: 'yyyy-mm-dd',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0,
                fontAwesome: true,
                pickerPosition: "bottom-left"
            });
            $('#endDate').datetimepicker({
                language: 'zh-CN',
                format: 'yyyy-mm-dd',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0,
                fontAwesome: true,
                pickerPosition: "bottom-left"
            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };
    //账户组管理
    JustMarvel.platform.pageAG = {
        init: function () {
            console.log("账户组管理");
            JustMarvel.platform.pageAG.menu();
            JustMarvel.platform.pageAG.dataInit();
            JustMarvel.platform.pageAG.addRecord();
            JustMarvel.platform.pageAG.editRecord();
            JustMarvel.platform.pageAG.delRecord();
            JustMarvel.platform.pageAG.batchDel();
            JustMarvel.platform.pageAG.goto();
        },
        menu: function () {

        },
        dataInit: function () {
            // $(".record-tool li a").on('click', function () {
            //     $("#edit-content").fadeToggle(300, 'easeInCubic');
            // });

        },
        //编辑
        editRecord: function () {
            $('.editRecord').on('click', function () {

                $(this).parents('tr').addClass('warning');

                //这里先通过接口获取数据，获取数据后，添加编辑按钮
                $('#record-submit').remove();
                $('#record-add').remove();

                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-submit\"><i class=\"fa fa-save\"></i>保存</a>");

                $('#viewRecord').modal('show');

                //添加的提交按钮，绑定提交事件
                $('#record-submit').on('click', function () {

                });
                //模态框隐藏后事件
                $('#viewRecord').on('hidden.bs.modal', function () {
                    $('.data-table tr').removeClass('warning'); //清除行高亮
                });

            });

        },
        //删除
        delRecord: function () {
            $('.delRecord').on('click', function () {
                $(this).parents('tr').addClass('danger');
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //确认删除
                $('#confirm-del').on('click', function () {
                    alert('删除');
                    $('#warning-message').alert('close');
                });
            });
        },
        //增加
        addRecord: function () {
            $('#addRecord').on('click', function () {
                $('#record-add').remove();
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-add\"><i class=\"fa fa-plus\"></i>添加</a>");
                $('#viewRecord').modal('show');

            });

        },
        //批量删除
        batchDel: function () {
            //全选
            $("#selectAll").on("click", function () {
                if ($(this).prop("checked")) {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", true);
                } else {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", false);
                }
            });


            //操作删除
            $('#batchDel').on('click', function () {
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //alert('批量删除');

            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };
    //代理商管理
    JustMarvel.platform.pageAgent = {
        init: function () {
            console.log("代理商管理");
            JustMarvel.platform.pageAgent.menu();
            JustMarvel.platform.pageAgent.dataInit();
            JustMarvel.platform.pageAgent.viewRecord();
            JustMarvel.platform.pageAgent.editRecord();
            JustMarvel.platform.pageAgent.delRecord();
            JustMarvel.platform.pageAgent.addRecord();
            JustMarvel.platform.pageAgent.batchDel();
            JustMarvel.platform.pageAgent.search();
            JustMarvel.platform.pageAgent.goto();
        },
        menu: function () {

        },
        dataInit: function () {
            // $(".record-tool li a").on('click', function () {
            //     $("#edit-content").fadeToggle(300, 'easeInCubic');
            // });
        },
        //查看
        viewRecord: function () {
            $('.viewRecord').on('click', function () {

                $('#viewRecord').find('input,select').attr("disabled", true); //disabled要在数据获取后添加，先写数据获取的方法，数据填充后VIEW操作，给所有INPUT，SELECT添加disabled
                $('#viewRecord').modal('show'); //显示模态框
                $(this).parents('tr').addClass('info'); //高亮选中行
            });

            $('#viewRecord').on('hidden.bs.modal', function (e) {
                //这里要执行清除数据
                $('#viewRecord').find('input,select').attr("disabled", false); //要清除表单数据
                //添加的按钮需要清除
                $('#record-submit').remove();
                $('#record-add').remove();

                $('.data-table tr').removeClass('info'); //清除行高亮
            })
        },
        //编辑
        editRecord: function () {
            $('.editRecord').on('click', function () {

                $(this).parents('tr').addClass('warning');

                //这里先通过接口获取数据，获取数据后，添加编辑按钮
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-submit\"><i class=\"fa fa-save\"></i>保存</a>");

                $('#viewRecord').modal('show');

                //添加的提交按钮，绑定提交事件
                $('#record-submit').on('click', function () {

                });
                //模态框隐藏后事件
                $('#viewRecord').on('hidden.bs.modal', function () {
                    $('.data-table tr').removeClass('warning'); //清除行高亮
                });

            });

        },
        //删除
        delRecord: function () {
            $('.delRecord').on('click', function () {
                $(this).parents('tr').addClass('danger');
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //确认删除
                $('#confirm-del').on('click', function () {
                    alert('删除');
                    $('#warning-message').alert('close');
                });
            });
        },
        //增加
        addRecord: function () {
            $('#addRecord').on('click', function () {
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-add\"><i class=\"fa fa-plus\"></i>添加</a>");
                $('#viewRecord').modal('show');
            });

        },
        //批量删除
        batchDel: function () {
            //全选
            $("#selectAll").on("click", function () {
                if ($(this).prop("checked")) {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", true);
                } else {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", false);
                }
            });


            //操作删除
            $('#batchDel').on('click', function () {
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //alert('批量删除');

            });
        },
        //搜索
        search: function () {

            $('#startDate').datetimepicker({
                language: 'zh-CN',
                format: 'yyyy-mm-dd',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0,
                fontAwesome: true,
                pickerPosition: "bottom-left"
            });
            $('#endDate').datetimepicker({
                language: 'zh-CN',
                format: 'yyyy-mm-dd',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0,
                fontAwesome: true,
                pickerPosition: "bottom-left"
            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }


    };
    //代理商组管理
    JustMarvel.platform.pageAgentGroup = {
        init: function () {
            console.log("代理商组管理");
            JustMarvel.platform.pageAgentGroup.menu();
            JustMarvel.platform.pageAgentGroup.dataInit();
            JustMarvel.platform.pageAgentGroup.addRecord();
            JustMarvel.platform.pageAgentGroup.editRecord();
            JustMarvel.platform.pageAgentGroup.delRecord();
            JustMarvel.platform.pageAgentGroup.batchDel();
            JustMarvel.platform.pageAgentGroup.goto();
        },
        menu: function () {

        },
        dataInit: function () {
            $(".record-tool li a").on('click', function () {
                $("#edit-content").fadeToggle(300, 'easeInCubic');
            });

        },
        //编辑
        editRecord: function () {
            $('.editRecord').on('click', function () {

                $(this).parents('tr').addClass('warning');

                //这里先通过接口获取数据，获取数据后，添加编辑按钮
                $('#record-submit').remove();
                $('#record-add').remove();

                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-submit\"><i class=\"fa fa-save\"></i>保存</a>");

                $('#viewRecord').modal('show');

                //添加的提交按钮，绑定提交事件
                $('#record-submit').on('click', function () {

                });
                //模态框隐藏后事件
                $('#viewRecord').on('hidden.bs.modal', function () {
                    $('.data-table tr').removeClass('warning'); //清除行高亮
                });

            });

        },
        //删除
        delRecord: function () {
            $('.delRecord').on('click', function () {
                $(this).parents('tr').addClass('danger');
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //确认删除
                $('#confirm-del').on('click', function () {
                    alert('删除');
                    $('#warning-message').alert('close');
                });
            });
        },
        //增加
        addRecord: function () {
            $('#addRecord').on('click', function () {
                $('#record-add').remove();
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-add\"><i class=\"fa fa-plus\"></i>添加</a>");
                $('#viewRecord').modal('show');

            });

        },
        //批量删除
        batchDel: function () {
            //全选
            $("#selectAll").on("click", function () {
                if ($(this).prop("checked")) {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", true);
                } else {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", false);
                }
            });


            //操作删除
            $('#batchDel').on('click', function () {
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //alert('批量删除');

            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }

    };
    //代理商数据报告
    JustMarvel.platform.pageAgentReport = {
        init: function () {
            console.log("代理商数据报告");
            JustMarvel.platform.pageAgentReport.menu();
            JustMarvel.platform.pageAgentReport.dataInit();
            JustMarvel.platform.pageAgentReport.goto();
        },
        menu: function () {

        },
        dataInit: function () {
            // $(".record-tool li a").on('click', function () {
            //     $("#edit-content").fadeToggle(300, 'easeInCubic');
            // });

        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };
    //设备管理
    JustMarvel.platform.pageDevice = {
        init: function () {
            console.log("设备管理");
            JustMarvel.platform.pageDevice.menu();
            JustMarvel.platform.pageDevice.dataInit();
            JustMarvel.platform.pageDevice.viewRecord();
            JustMarvel.platform.pageDevice.editRecord();
            JustMarvel.platform.pageDevice.delRecord();
            JustMarvel.platform.pageDevice.addRecord();
            JustMarvel.platform.pageDevice.batchDel();
            JustMarvel.platform.pageDevice.search();
            JustMarvel.platform.pageDevice.goto();
        },
        menu: function () {

        },
        dataInit: function () {
            $(".record-tool li a").on('click', function () {
                $("#edit-content").fadeToggle(300, 'easeInCubic');
            });

        },
        //查看
        viewRecord: function () {
            $('.viewRecord').on('click', function () {

                $('#viewRecord').find('input,select').attr("disabled", true); //disabled要在数据获取后添加，先写数据获取的方法，数据填充后VIEW操作，给所有INPUT，SELECT添加disabled
                $('#viewRecord').modal('show'); //显示模态框
                $(this).parents('tr').addClass('info'); //高亮选中行
            });

            $('#viewRecord').on('hidden.bs.modal', function (e) {
                //这里要执行清除数据
                $('#viewRecord').find('input,select').attr("disabled", false); //要清除表单数据
                //添加的按钮需要清除
                $('#record-submit').remove();
                $('#record-add').remove();

                $('.data-table tr').removeClass('info'); //清除行高亮
            })
        },
        //编辑
        editRecord: function () {
            $('.editRecord').on('click', function () {

                $(this).parents('tr').addClass('warning');

                //这里先通过接口获取数据，获取数据后，添加编辑按钮
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-submit\"><i class=\"fa fa-save\"></i>保存</a>");

                $('#viewRecord').modal('show');

                //添加的提交按钮，绑定提交事件
                $('#record-submit').on('click', function () {

                });
                //模态框隐藏后事件
                $('#viewRecord').on('hidden.bs.modal', function () {
                    $('.data-table tr').removeClass('warning'); //清除行高亮
                });

            });

        },
        //删除
        delRecord: function () {
            $('.delRecord').on('click', function () {
                $(this).parents('tr').addClass('danger');
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //确认删除
                $('#confirm-del').on('click', function () {
                    alert('删除');
                    $('#warning-message').alert('close');
                });
            });
        },
        //增加
        addRecord: function () {
            $('#addRecord').on('click', function () {
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-add\"><i class=\"fa fa-plus\"></i>添加</a>");
                $('#viewRecord').modal('show');
            });

        },
        //批量删除
        batchDel: function () {
            //全选
            $("#selectAll").on("click", function () {
                if ($(this).prop("checked")) {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", true);
                } else {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", false);
                }
            });


            //操作删除
            $('#batchDel').on('click', function () {
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //alert('批量删除');

            });
        },
        //搜索
        search: function () {

            $('#startDate').datetimepicker({
                language: 'zh-CN',
                format: 'yyyy-mm-dd',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0,
                fontAwesome: true,
                pickerPosition: "bottom-left"
            });
            $('#endDate').datetimepicker({
                language: 'zh-CN',
                format: 'yyyy-mm-dd',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0,
                fontAwesome: true,
                pickerPosition: "bottom-left"
            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }

    };
    //设备组管理
    JustMarvel.platform.pageDeviceGroup = {
        init: function () {
            console.log("设备组管理");
            JustMarvel.platform.pageDeviceGroup.menu();
            JustMarvel.platform.pageDeviceGroup.dataInit();
            JustMarvel.platform.pageDeviceGroup.addRecord();
            JustMarvel.platform.pageDeviceGroup.editRecord();
            JustMarvel.platform.pageDeviceGroup.delRecord();
            JustMarvel.platform.pageDeviceGroup.batchDel();
            JustMarvel.platform.pageDeviceGroup.goto();
        },
        menu: function () {

        },
        dataInit: function () {
            $(".record-tool li a").on('click', function () {
                $("#edit-content").fadeToggle(300, 'easeInCubic');
            });

        },
        //编辑
        editRecord: function () {
            $('.editRecord').on('click', function () {

                $(this).parents('tr').addClass('warning');

                //这里先通过接口获取数据，获取数据后，添加编辑按钮
                $('#record-submit').remove();
                $('#record-add').remove();

                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-submit\"><i class=\"fa fa-save\"></i>保存</a>");

                $('#viewRecord').modal('show');

                //添加的提交按钮，绑定提交事件
                $('#record-submit').on('click', function () {

                });
                //模态框隐藏后事件
                $('#viewRecord').on('hidden.bs.modal', function () {
                    $('.data-table tr').removeClass('warning'); //清除行高亮
                });

            });

        },
        //删除
        delRecord: function () {
            $('.delRecord').on('click', function () {
                $(this).parents('tr').addClass('danger');
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //确认删除
                $('#confirm-del').on('click', function () {
                    alert('删除');
                    $('#warning-message').alert('close');
                });
            });
        },
        //增加
        addRecord: function () {
            $('#addRecord').on('click', function () {
                $('#record-add').remove();
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-add\"><i class=\"fa fa-plus\"></i>添加</a>");
                $('#viewRecord').modal('show');

            });

        },
        //批量删除
        batchDel: function () {
            //全选
            $("#selectAll").on("click", function () {
                //console.log(111);
                if ($(this).prop("checked")) {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", true);
                } else {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", false);
                }
            });


            //操作删除
            $('#batchDel').on('click', function () {
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //alert('批量删除');

            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };
    //4G流量管理
    JustMarvel.platform.page4g = {
        init: function () {
            console.log("4G流量管理");
            JustMarvel.platform.page4g.menu();
            JustMarvel.platform.page4g.dataInit();
            JustMarvel.platform.page4g.viewRecord();
            JustMarvel.platform.page4g.recharge();
            JustMarvel.platform.page4g.addRecord();
            JustMarvel.platform.page4g.batchDel();
            JustMarvel.platform.page4g.goto();
        },
        menu: function () {

        },
        dataInit: function () {
            $(".record-tool li a").on('click', function () {
                $("#edit-content").fadeToggle(300, 'easeInCubic');
            });

        },
        //查看
        viewRecord: function () {
            $('.viewRecord').on('click', function () {

                $('#viewRecord').find('input,select').attr("disabled", true); //disabled要在数据获取后添加，先写数据获取的方法，数据填充后VIEW操作，给所有INPUT，SELECT添加disabled
                $('#viewRecord').modal('show'); //显示模态框
                $(this).parents('tr').addClass('info'); //高亮选中行
            });

            $('#viewRecord').on('hidden.bs.modal', function (e) {
                //这里要执行清除数据
                $('#viewRecord').find('input,select').attr("disabled", false); //要清除表单数据
                //添加的按钮需要清除
                $('#record-submit').remove();
                $('#record-add').remove();

                $('.data-table tr').removeClass('info'); //清除行高亮
            })
        },
        recharge: function () {

        },
        //增加
        addRecord: function () {
            $('#addRecord').on('click', function () {
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-add\"><i class=\"fa fa-plus\"></i>添加</a>");
                $('#viewRecord').modal('show');
            });

        },
        //批量删除
        batchDel: function () {
            //全选
            $("#selectAll").on("click", function () {
                if ($(this).prop("checked")) {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", true);
                } else {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", false);
                }
            });


            //操作删除
            $('#batchDel').on('click', function () {
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //alert('批量删除');

            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };
    //视频管理
    JustMarvel.platform.pageVideoLibrary = {
        init: function () {
            console.log("视频管理");
            JustMarvel.platform.pageVideoLibrary.menu();
            JustMarvel.platform.pageVideoLibrary.dataInit();
            JustMarvel.platform.pageVideoLibrary.videoPlay();
            JustMarvel.platform.pageVideoLibrary.downLoad();
            JustMarvel.platform.pageVideoLibrary.delRecord();
            JustMarvel.platform.pageVideoLibrary.search();
            JustMarvel.platform.pageVideoLibrary.goto();
        },
        menu: function () {

        },
        dataInit: function () {
            $(".record-tool li a").on('click', function () {
                $("#edit-content").fadeToggle(300, 'easeInCubic');
            });

        },
        videoPlay: function () {
            $('.video-play').on('click', function () {

                $('#custom-video').append("<source src=\"video/Acacia.mp4\" type=\"video/mp4\" />");
                $('#modal-video').modal('show');

            });
            $('#modal-video').on('hide.bs.modal', function () {
                $('#custom-video').get(0).pause();
                $('#custom-video').load();
                $('#custom-video').empty();

            });
        },
        //下载视频
        downLoad: function () {
            $('.downLoad').on('click', function () {
                alert('下载视频');
            });
        },
        //删除
        delRecord: function () {
            $('.delRecord').on('click', function () {
                $(this).parents('tr').addClass('danger');
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //确认删除
                $('#confirm-del').on('click', function () {
                    alert('删除');
                    $('#warning-message').alert('close');
                });
            });
        },
        //搜索
        search: function () {

            $('#startDate').datetimepicker({
                language: 'zh-CN',
                format: 'yyyy-mm-dd',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0,
                fontAwesome: true,
                pickerPosition: "bottom-left"
            });
            $('#endDate').datetimepicker({
                language: 'zh-CN',
                format: 'yyyy-mm-dd',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0,
                fontAwesome: true,
                pickerPosition: "bottom-left"
            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };
    //车辆数据
    JustMarvel.platform.pageCarData = {
        init: function () {
            console.log("车辆数据");
            JustMarvel.platform.pageCarData.menu();
            JustMarvel.platform.pageCarData.dataInit();
            JustMarvel.platform.pageCarData.goto();
        },
        menu: function () {

        },
        dataInit: function () {
            $(".record-tool li a").on('click', function () {
                $("#edit-content").fadeToggle(300, 'easeInCubic');
            });

        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };
    //车辆事件
    JustMarvel.platform.pageCarEvent = {
        init: function () {
            console.log("车辆事件");
            JustMarvel.platform.pageCarEvent.menu();
            JustMarvel.platform.pageCarEvent.dataInit();
            JustMarvel.platform.pageCarEvent.search();
            JustMarvel.platform.pageCarEvent.goto();
        },
        menu: function () {

        },
        dataInit: function () {
            $(".record-tool li a").on('click', function () {
                $("#edit-content").fadeToggle(300, 'easeInCubic');
            });

        },
        //搜索
        search: function () {

            $('#startDate').datetimepicker({
                language: 'zh-CN',
                format: 'yyyy-mm-dd',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0,
                fontAwesome: true,
                pickerPosition: "bottom-left"
            });
            $('#endDate').datetimepicker({
                language: 'zh-CN',
                format: 'yyyy-mm-dd',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0,
                fontAwesome: true,
                pickerPosition: "bottom-left"
            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };
    //车辆管理
    JustMarvel.platform.pageCarManage = {
        init: function () {
            console.log("车辆管理");
            JustMarvel.platform.pageCarManage.menu();
            JustMarvel.platform.pageCarManage.dataInit();
            JustMarvel.platform.pageCarManage.viewRecord();
            JustMarvel.platform.pageCarManage.editRecord();
            JustMarvel.platform.pageCarManage.delRecord();
            JustMarvel.platform.pageCarManage.mapRecord();
            JustMarvel.platform.pageCarManage.mapHistory();
            JustMarvel.platform.pageCarManage.search();
            JustMarvel.platform.pageCarManage.goto();


        },
        menu: function () {

        },
        dataInit: function () {
            $(".record-tool li a").on('click', function () {
                $("#edit-content").fadeToggle(300, 'easeInCubic');
            });

        },
        //查看
        viewRecord: function () {
            $('.viewRecord').on('click', function () {

                $('#viewRecord').find('input,select').attr("disabled", true); //disabled要在数据获取后添加，先写数据获取的方法，数据填充后VIEW操作，给所有INPUT，SELECT添加disabled
                $('#viewRecord').modal('show'); //显示模态框
                $(this).parents('tr').addClass('info'); //高亮选中行
            });

            $('#viewRecord').on('hidden.bs.modal', function (e) {
                //这里要执行清除数据
                $('#viewRecord').find('input,select').attr("disabled", false); //要清除表单数据
                //添加的按钮需要清除
                $('#record-submit').remove();
                $('#record-add').remove();

                $('.data-table tr').removeClass('info'); //清除行高亮
            })
        },
        //编辑
        editRecord: function () {
            $('.editRecord').on('click', function () {

                $(this).parents('tr').addClass('warning');

                //这里先通过接口获取数据，获取数据后，添加编辑按钮
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-submit\"><i class=\"fa fa-save\"></i>保存</a>");

                $('#viewRecord').modal('show');

                //添加的提交按钮，绑定提交事件
                $('#record-submit').on('click', function () {

                });
                //模态框隐藏后事件
                $('#viewRecord').on('hidden.bs.modal', function () {
                    $('.data-table tr').removeClass('warning'); //清除行高亮
                });

            });

        },
        //删除
        delRecord: function () {
            $('.delRecord').on('click', function () {
                $(this).parents('tr').addClass('danger');
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //确认删除
                $('#confirm-del').on('click', function () {
                    alert('删除');
                    $('#warning-message').alert('close');
                });
            });
        },
        //地图加载
        mapRecord: function () {
            $('.carRecord').on('click', function () {
                $('#carRecord').modal('show'); //显示模态框
                $('#carRecord').find('input,select').attr("disabled", true); //disabled要在数据获取后添加，先写数据获取的方法，数据填充后VIEW操作，给所有INPUT，SELECT添加disabled
                var map,marker;
                map = new AMap.Map('mapcontainer', {
                    zoom: 13, //级别
                    viewMode: '3D' //使用3D视图
                });
                // 创建一个 Marker 实例：
                marker = new AMap.Marker({
                    position: [116.397428, 39.90923], // 经纬度对象，也可以是经纬度构成的一维数组[116.39, 39.9]
                });

                // 将创建的点标记添加到已有的地图实例：
                //map.add(marker);

            });

        },
        //设备轨迹
        mapHistory:function(){
            $('.carHistory').on('click', function () {
                $('#carHistory').modal('show'); //显示模态框
                $('#carHistory').find('input,select').attr("disabled", true); //disabled要在数据获取后添加，先写数据获取的方法，数据填充后VIEW操作，给所有INPUT，SELECT添加disabled
                var map,marker;
                // map = new AMap.Map('mapHistorycontainer', {
                //     zoom: 13, //级别
                //     viewMode: '3D' //使用3D视图
                // });
                // // 创建一个 Marker 实例：
                // marker = new AMap.Marker({
                //     position: [116.397428, 39.90923], // 经纬度对象，也可以是经纬度构成的一维数组[116.39, 39.9]
                // });

                // 将创建的点标记添加到已有的地图实例：
                //map.add(marker);

            });
        },
        //搜索
        search: function () {

            $('#startDate').datetimepicker({
                language: 'zh-CN',
                format: 'yyyy-mm-dd',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0,
                fontAwesome: true,
                pickerPosition: "bottom-left"
            });
            $('#endDate').datetimepicker({
                language: 'zh-CN',
                format: 'yyyy-mm-dd',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0,
                fontAwesome: true,
                pickerPosition: "bottom-left"
            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };


    //任务管理
    JustMarvel.platform.pageTask = {
        init: function () {
            console.log("任务管理");
            JustMarvel.platform.pageTask.menu();
            JustMarvel.platform.pageTask.dataInit();
            JustMarvel.platform.pageTask.viewRecord();
            //JustMarvel.platform.pageTask.editRecord();
            JustMarvel.platform.pageTask.delRecord();
            //JustMarvel.platform.pageTask.addRecord();
            JustMarvel.platform.pageTask.batchDel();
            JustMarvel.platform.pageTask.search();
            JustMarvel.platform.pageTask.goto();
        },
        menu: function () {

        },
        //数据初始化
        dataInit: function () {
            //$(".record-tool li a").on('click', function () {
            //    $("#edit-content").fadeToggle(300, 'easeInCubic');
            //});

        },
        //查看
        viewRecord: function () {
            $('.viewRecord').on('click', function () {

                $('#viewRecord').find('input,select').attr("disabled", true); //disabled要在数据获取后添加，先写数据获取的方法，数据填充后VIEW操作，给所有INPUT，SELECT添加disabled
                $('#viewRecord').modal('show'); //显示模态框
                $(this).parents('tr').addClass('info'); //高亮选中行
            });

            $('#viewRecord').on('hidden.bs.modal', function (e) {
                //这里要执行清除数据
                $('#viewRecord').find('input,select').attr("disabled", false); //要清除表单数据
                //添加的按钮需要清除
                $('#record-submit').remove();
                $('#record-add').remove();

                $('.data-table tr').removeClass('info'); //清除行高亮
            })
        },

        //删除
        delRecord: function () {
            $('.delRecord').on('click', function () {
                $(this).parents('tr').addClass('danger');
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //确认删除
                $('#confirm-del').on('click', function () {
                    alert('删除');
                    $('#warning-message').alert('close');
                });

            });
        },

        //批量删除
        batchDel: function () {
            //全选
            $("#selectAll").on("click", function () {
                if ($(this).prop("checked")) {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", true);
                } else {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", false);
                }
            });


            //操作删除
            $('#batchDel').on('click', function () {
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //alert('批量删除');

            });
        },
        //搜索
        search: function () {
            $('#searchname').on('click', function () {
                alert("搜索");

            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };


    //接单管理
    JustMarvel.platform.pageReceipt = {
        init: function () {
            console.log("接单管理");
            JustMarvel.platform.pageReceipt.menu();
            JustMarvel.platform.pageReceipt.dataInit();
            //JustMarvel.platform.pageReceipt.viewRecord();
            JustMarvel.platform.pageReceipt.editRecord();
            JustMarvel.platform.pageReceipt.delRecord();
            JustMarvel.platform.pageReceipt.valRecord();
            //JustMarvel.platform.pageReceipt.addRecord();
            //JustMarvel.platform.pageReceipt.batchDel();
            JustMarvel.platform.pageReceipt.search();
            JustMarvel.platform.pageReceipt.goto();
        },
        menu: function () {

        },
        //数据初始化
        dataInit: function () {
            //$(".record-tool li a").on('click', function () {
            //    $("#edit-content").fadeToggle(300, 'easeInCubic');
            //});

        },
        //验证
        valRecord: function () {
            $('.valRecord').on('click', function () {
                alert("验证");

            });
        },

        //修改
        editRecord: function () {
            $('.editRecord').on('click', function () {

                $(this).parents('tr').addClass('warning');

                //这里先通过接口获取数据，获取数据后，添加编辑按钮
                $('#editRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-submit\"><i class=\"fa fa-save\"></i>保存</a>");

                $('#editRecord').modal('show');

                //添加的提交按钮，绑定提交事件
                $('#record-submit').on('click', function () {

                });
                //模态框隐藏后事件
                $('#editRecord').on('hidden.bs.modal', function () {
                    $('.data-table tr').removeClass('warning'); //清除行高亮
                    //添加的按钮需要清除
                    $('#record-submit').remove();
                    $('#record-add').remove();

                });

            });

        },
        //删除
        delRecord: function () {
            $('.delRecord').on('click', function () {
                $(this).parents('tr').addClass('danger');
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //确认删除
                $('#confirm-del').on('click', function () {
                    alert('删除');
                    $('#warning-message').alert('close');
                });

            });
        },
        //增加
        /*addRecord: function () {
            $('#addRecord').on('click', function () {
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-add\"><i class=\"fa fa-plus\"></i>添加</a>");
                $('#viewRecord').modal('show');
            });

        },*/
        //批量删除
        /*batchDel: function () {
            $('#batchDel').on('click', function () {
                alert('批量删除');
            });
        },*/
        //搜索
        search: function () {

            $('#searchname').on('click', function () {
                alert("搜索");

            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };


    //SN管理
    JustMarvel.platform.pageSN = {
        init: function () {
            console.log("SN管理");
            JustMarvel.platform.pageSN.menu();
            // JustMarvel.platform.pageSN.view();
            JustMarvel.platform.pageSN.dataInit();
            //stMarvel.platform.pageAdmin.viewRecord();
            JustMarvel.platform.pageSN.handleRecord();
            JustMarvel.platform.pageSN.editRecord();
            //JustMarvel.platform.pageSN.delRecord();
            JustMarvel.platform.pageSN.addRecord();
            JustMarvel.platform.pageSN.batchHandle();
            JustMarvel.platform.pageSN.batchType();


            JustMarvel.platform.pageSN.search();
            JustMarvel.platform.pageSN.goto();
        },
        menu: function () {

        },

        //数据初始化
        dataInit: function () {
            //$(".record-tool li a").on('click', function () {
            //    $("#edit-content").fadeToggle(300, 'easeInCubic');
            //});

        },
        //分配
        handleRecord: function () {
            $('.handleRecord').on('click', function () {
                alert("分配");

            });
        },


        //编辑
        editRecord: function () {
            $('.editRecord').on('click', function () {
                $(this).parents('tr').addClass('warning');
                //这里先通过接口获取数据，获取数据后，添加编辑按钮
                $('#editRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-submit\"><i class=\"fa fa-save\"></i>保存</a>");

                $('#editRecord').modal('show');

                //添加的提交按钮，绑定提交事件
                $('#record-submit').on('click', function () {

                });
                //模态框隐藏后事件
                $('#editRecord').on('hidden.bs.modal', function () {
                    $('.data-table tr').removeClass('warning'); //清除行高亮
                    //添加的按钮需要清除
                    $('#record-submit').remove();
                    $('#record-add').remove();

                });

            });

        },

        //增加
        addRecord: function () {
            $('#addRecord').on('click', function () {
                $('#editRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-add\"><i class=\"fa fa-plus\"></i>添加</a>");
                $('#editRecord').modal('show');
            });

            //模态框隐藏后事件
            $('#editRecord').on('hidden.bs.modal', function () {
                //添加的按钮需要清除
                $('#record-add').remove();

            });

        },

        //批量分配
        batchHandle: function () {
            $('#batchHandle').on('click', function () {
                alert("批量分配");

            });
        },

        //增加类型
        batchType: function () {
            $('#batchType').on('click', function () {
                alert("增加类型");

            });
        },

        //搜索
        search: function () {
            $('#searchname').on('click', function () {
                alert("搜索");

            });

        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };


    //工单管理
    JustMarvel.platform.pageWrokOrder = {
        init: function () {
            console.log("工单管理");
            JustMarvel.platform.pageWrokOrder.menu();
            JustMarvel.platform.pageWrokOrder.dataInit();
            JustMarvel.platform.pageWrokOrder.handleRecord();
            //JustMarvel.platform.pageWrokOrder.editRecord();
            JustMarvel.platform.pageWrokOrder.delRecord();
            //JustMarvel.platform.pageWrokOrder.addRecord();
            JustMarvel.platform.pageWrokOrder.batchDel();
            JustMarvel.platform.pageWrokOrder.search();
            JustMarvel.platform.pageWrokOrder.goto();
        },
        menu: function () {

        },
        //数据初始化
        dataInit: function () {
            //$(".record-tool li a").on('click', function () {
            //    $("#edit-content").fadeToggle(300, 'easeInCubic');
            //});

        },

        //处理
        handleRecord: function () {
            $('.handleRecord').on('click', function () {
                alert("处理");

            });
        },

        //删除
        delRecord: function () {
            $('.delRecord').on('click', function () {
                $(this).parents('tr').addClass('danger');
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //确认删除
                $('#confirm-del').on('click', function () {
                    alert('删除');
                    $('#warning-message').alert('close');
                });

            });
        },

        //批量删除
        batchDel: function () {
            //全选
            $("#selectAll").on("click", function () {
                if ($(this).prop("checked")) {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", true);
                } else {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", false);
                }
            });


            //操作删除
            $('#batchDel').on('click', function () {
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //alert('批量删除');

            });
        },

        //搜索
        search: function () {
            $('#searchname').on('click', function () {
                alert("搜索");

            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };


    //系统设置
    JustMarvel.platform.pageSystem = {
        init: function () {
            console.log("系统设置");
            JustMarvel.platform.pageSystem.menu();
            JustMarvel.platform.pageSystem.view();
        },
        menu: function () {

        },
        view: function () {
            $(".record-tool li a").on('click', function () {
                $("#edit-content").fadeToggle(300, 'easeInCubic');
            });

        },
    };
    //管理员设置
    JustMarvel.platform.pageAdmin = {
        init: function () {
            console.log("管理员设置");
            JustMarvel.platform.pageAdmin.menu();
            JustMarvel.platform.pageAdmin.dataInit();
            JustMarvel.platform.pageAdmin.viewRecord();
            JustMarvel.platform.pageAdmin.editRecord();
            JustMarvel.platform.pageAdmin.delRecord();
            JustMarvel.platform.pageAdmin.addRecord();
            JustMarvel.platform.pageAdmin.batchDel();
            JustMarvel.platform.pageAdmin.search();
            JustMarvel.platform.pageAdmin.goto();
        },
        menu: function () {

        },
        //数据初始化
        dataInit: function () {
            //$(".record-tool li a").on('click', function () {
            //    $("#edit-content").fadeToggle(300, 'easeInCubic');
            //});

        },
        //查看
        viewRecord: function () {
            $('.viewRecord').on('click', function () {
                $('#viewRecord').find('input,select').attr("disabled", true); //disabled要在数据获取后添加，先写数据获取的方法，数据填充后VIEW操作，给所有INPUT，SELECT添加disabled
                $('#viewRecord').modal('show'); //显示模态框
                $(this).parents('tr').addClass('info'); //高亮选中行
            });

            $('#viewRecord').on('hidden.bs.modal', function (e) {
                //这里要执行清除数据
                $('#viewRecord').find('input,select').attr("disabled", false); //要清除表单数据
                //添加的按钮需要清除
                $('#record-submit').remove();
                $('#record-add').remove();

                $('.data-table tr').removeClass('info'); //清除行高亮
            })
        },
        //编辑
        editRecord: function () {
            $('.editRecord').on('click', function () {

                $(this).parents('tr').addClass('warning');

                //这里先通过接口获取数据，获取数据后，添加编辑按钮
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-submit\"><i class=\"fa fa-save\"></i>保存</a>");

                $('#viewRecord').modal('show');

                //添加的提交按钮，绑定提交事件
                $('#record-submit').on('click', function () {

                });
                //模态框隐藏后事件
                $('#viewRecord').on('hidden.bs.modal', function () {
                    $('.data-table tr').removeClass('warning'); //清除行高亮
                });

            });

        },
        //删除
        delRecord: function () {
            $('.delRecord').on('click', function () {
                $(this).parents('tr').addClass('danger');
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //确认删除
                $('#confirm-del').on('click', function () {
                    alert('删除');
                    $('#warning-message').alert('close');
                });

            });
        },
        //增加
        addRecord: function () {
            $('#addRecord').on('click', function () {
                $('#viewRecord .modal-footer').append("<a class=\"btn btn-success\" id=\"record-add\"><i class=\"fa fa-plus\"></i>添加</a>");
                $('#viewRecord').modal('show');
            });

        },

        //批量删除
        batchDel: function () {
            //全选
            $("#selectAll").on("click", function () {
                if ($(this).prop("checked")) {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", true);
                } else {
                    $(".data-table tbody input[type='checkbox']").not(this).prop("checked", false);
                }
            });


            //操作删除
            $('#batchDel').on('click', function () {
                //添加警告
                $body.append("<div id=\"warning-message\" class=\"alert alert-danger alert-dismissible fade in\" role=\"alert\">" +
                    "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>" +
                    "<h4 class=\"text-center\">确认要删除该条记录吗？</h4>" +
                    "<p class=\"text-center\"><a id=\"confirm-del\" class=\"btn btn-danger\">确认删除</a><a class=\"btn btn-default cancle\" >取消</a></p>" +
                    "</div>"
                );
                $('#warning-message').show();

                //手动关闭警告框
                $('#warning-message .cancle').on('click', function () {
                    $('#warning-message').alert('close');
                });

                //警告框移除后事件
                $('#warning-message').on('closed.bs.alert', function () {
                    $('.data-table tr').removeClass('danger'); //清除行高亮
                });

                //alert('批量删除');

            });
        },

        //搜索
        search: function () {

            $('#searchname').on('click', function () {
                alert("搜索");

            });
        },
        //前往页面
        goto: function () {
            $('#gotoPage').on('click', function () {
                var target = $('#goto').val();
                if (target > 0) {
                    alert(target);
                };

            });
        }
    };

    //DOM加载完成
    JustMarvel.documentOnReady = {
        init: function () {}
    };
    //文档加载完成
    JustMarvel.documentOnLoad = {
        init: function () {
            JustMarvel.initialize.init();
        }
    };
    JustMarvel.documentOnResize = {
        init: function () {}
    };

    //全局参数定义
    var currenttime = function () {
        var currenttime = new Date().toLocaleTimeString().replace(/^\D*/, '');
        return currenttime;
    };

    //全局页面DOM定义
    var $window = $(window),
        $body = $('body'),
        $wrapper = $("#wrapper");

    var $pageIndex = $(".page-index"),
        $pageAccount = $(".page-account"),
        $pageAccountGroup = $(".page-accountGroup"),
        $pageAgent = $(".page-agent"),
        $pageAgentGroup = $(".page-agentGroup"),
        $pageAgentReport = $('.page-agentReport'),
        $pageDevice = $('.page-device'),
        $pageDeviceGroup = $('.page-deviceGroup'),
        $page4G = $(".page-4g"),
        $pageVideoLibrary = $('.page-videoLibrary'),
        $pageCarData = $('.page-carData'),
        $pageCarEvent = $('.page-carEvent'),
        $pageCarManage = $('.page-carManage'),
        $pageTask = $('.page-task'),
        $pageReceipt = $('.page-receipt'),
        $pageSN = $(".page-sn"),
        $pageWrokOrder = $(".page-workOrder"),
        $pageSystem = $('.page-system'),
        $pageAdmin = $(".page-admin");


    $(document).ready(JustMarvel.documentOnReady.init);
    $window.load(JustMarvel.documentOnLoad.init);
    $window.resize(function () {
        JustMarvel.platform.frame();
    });
})(jQuery);